import request from '@/utils/request'

// 用户相关接口
export const userApi = {
    // 账密登录
    mobileLogin: (data) => {
        return request({
            url: '/login/mobileLogin',
            method: 'post',
            data
        })
    },
    // 手机号登录
    smsLogin: (data) => {
        return request({
            url: '/login/smsLogin',
            method: 'post',
            data
        })
    },
    // 退出登录
    logout: () => {
        return request({
            url: '/member/logout',
            method: 'get'
        })
    },
    // 发送登录短信
    loginSms: (mobile) => {
        return request({
            url: '/login/sms',
            method: 'post',
            data: { mobile }
        })
    },
    // 获取用户信息
    getUserInfo: () => {
        return request({
            url: '/member/info',
            method: 'get'
        })
    },
    // 更新用户信息
    updateUserInfo: (data) => {
        return request({
            url: '/member/updateInfo',
            method: 'post',
            data
        })
    },
    // 更新用户密码
    updateUserPassword: (data) => {
        return request({
            url: '/member/changePwd',
            method: 'post',
            data
        })
    }
}

// 考试相关接口
export const examApi = {
    // 获取考试列表
    getExamList: (params) => {
        return request({
            url: '/exam/list',
            method: 'get',
            params
        })
    },
    // 创建考试
    createExam: (data) => {
        return request({
            url: '/exam/create',
            method: 'post',
            data
        })
    }
}